home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / misc~1 / 447 / dreidel / dreidel.lst < prev    next >
File List  |  1990-02-04  |  21KB  |  979 lines

  1. '
  2. ' **********************************************************************
  3. '                              D R E I D E L
  4. '                       A Traditional Game of Chance
  5. '                   yet another kidprg in GFA Basic from
  6. '                               D.A. Brumleve
  7. '                    Copyright 1989 by Analog Computing
  8. ' **********************************************************************
  9. '                               Version 1.2
  10. '                              July 24, 1989
  11. ' **********************************************************************
  12. '                                REFERENCE
  13. ' Significant variables:
  14. ' Spinner$(1-4)=the four sprites used to show the dreidel spinning
  15. ' Dreidel$(1-4)=the four sides of the dreidel
  16. ' Dreidel%=the randomly-chosen "up" side of the dreidel when spun
  17. ' Spin%=the randomly-chosen number of rotations of the dreidel when spun
  18. ' Token$=the sprite imitating a coin or token for use in scoring
  19. ' Token%(1-2)=the number of tokens held by each player
  20. ' Pot_token%=the number of tokens in the pot
  21. ' Position_token%(0-2,0-9)=indicates whether or not a particular position
  22. '         in each player's token area contains a token
  23. ' Clor%(1-2)=the color associated with Players 1 and 2
  24. ' Player%=the number (1 or 2) of the current player
  25. ' Position_pot_token%(0-10)=indicates location of token in the pot
  26. '
  27. ' **********************************************************************
  28. '
  29. ' ***************************** INITIALIZATION *************************
  30. Dim Palette%(15)
  31. Num%=5
  32. Dim Clip_len%(Num%),Colr_len%(Num%),Colr$(Num%)
  33. Dim Clip_width%(Num%),Clip_hite%(Num%),Rez_pic%(Num%)
  34. Dim Clor%(2)
  35. Dim Lttlepic$(5),Dreidel$(5),Spinner$(4),Lttr$(12),Offset%(2)
  36. Dim Token%(2),Position_token%(2,9),Position_pot_token%(10),Player_name$(2)
  37. @Check_rez
  38. Hidem
  39. @Save_palette
  40. @Black_screen
  41. Filename$="SPIN.DAT"
  42. Num%=4
  43. @Load_spinner
  44. For I%=1 To 4
  45.   Spinner$(I%)=Lttlepic$(I%)
  46. Next I%
  47. Filename$="DREIDEL.DAT"
  48. Num%=5
  49. @Load_spinner
  50. For I%=1 To 4
  51.   Dreidel$(I%)=Lttlepic$(I%)
  52. Next I%
  53. Token$=Lttlepic$(5)
  54. Graphmode 2
  55. @Main_screen
  56. @Title
  57. Cls
  58. Setcolor 7,2,2,2
  59. Sput Screen$
  60. Clor%(1)=5
  61. Clor%(2)=1
  62. Defmouse 3
  63. @Player_name
  64. '
  65. ' **************************** MAIN PROGRAM ****************************
  66. Do
  67.   @Beginning_set_up
  68.   @Start_round
  69.   Do
  70.     @Spin_the_dreidel
  71.     Exit If Game_over%=1
  72.   Loop
  73. Loop
  74. '
  75. ' ***************************** SPIN ***********************************
  76. Procedure Spin_the_dreidel
  77.   T$=Player_name$(Player%)+", spin the dreidel."
  78.   Deftext Clor%(Player%),0,0,13
  79.   Text 53+Offset%(Player%),72,T$
  80.   Color Clor%(Player%)
  81.   Box 108,81,211,199
  82.   Pb%=Player%
  83.   @Player_box
  84.   Try_again:
  85.   Showm
  86.   @Let_go
  87.   Repeat
  88.     Mouse Mx%,My%,Mk%
  89.   Until Mk%>0
  90.   If Mx%>0 And Mx%<44 And My%>0 And My%<18 And Mk%>0
  91.     @Wanna_quit
  92.     Goto Try_again
  93.   Endif
  94.   If Mx%>275 And Mx%<319 And My%>0 And My%<18
  95.     @Info
  96.     Goto Try_again
  97.   Endif
  98.   If Mx%>108 And Mx%<211 And My%>81 And My%<199
  99.     @Clear_instructions
  100.     @Clear_dreidel_box
  101.     Hidem
  102.     Dreidel%=Random(4)+1
  103.     Spin%=(Random(5)+1)*2
  104.     Sound 1,0,1,4,0
  105.     Wave 1,1,8,1000,0
  106.     For I%=1 To Spin%
  107.       For J%=1 To 3
  108.         Put 109,82,Spinner$(J%)
  109.         Pause 2
  110.       Next J%
  111.     Next I%
  112.     Put 109,82,Spinner$(4)
  113.     Pause 7
  114.     Wave 0,0
  115.     Put 135,94,Dreidel$(Dreidel%)
  116.     Restore Dreidel_data
  117.     For I%=1 To 4
  118.       Read D$,L%
  119.       If Dreidel%=I%
  120.         Spin_score$=D$
  121.         Lx%=L%
  122.       Endif
  123.     Next I%
  124.     Deftext Clor%(Player%),0,0,13
  125.     Text Lx%,72,Spin_score$
  126.   Else
  127.     @Buzz_sound
  128.     Goto Try_again
  129.   Endif
  130.   If Dreidel%=1
  131.     Pause 150
  132.   Endif
  133.   If Dreidel%=2
  134.     @Gimmel
  135.   Endif
  136.   If Dreidel%=3
  137.     @Heh
  138.   Endif
  139.   If Dreidel%=4
  140.     @Shin
  141.   Endif
  142.   @Clear_instructions
  143.   @Clear_player_box
  144.   If Pot_token%=0
  145.     @Round_over
  146.     @Start_round
  147.   Endif
  148.   If Pot_token%=1
  149.     @Round_over
  150.     @Start_round
  151.   Endif
  152.   If Game_over%=1
  153.     Goto New_game
  154.   Endif
  155.   @New_player
  156.   New_game:
  157. Return
  158. '
  159. ' ******************************* ROUNDS *******************************
  160. Procedure Beginning_set_up
  161.   Game_over%=0
  162.   Pot_token%=0
  163.   Put 109,82,Spinner$(1)
  164.   For I%=1 To 10
  165.     Position_pot_token%(I%)=0
  166.   Next I%
  167.   For I%=1 To 2
  168.     Token%(I%)=5
  169.   Next I%
  170.   Deffill 0
  171.   Pbox 1,22,318,52
  172.   Pbox 1,82,104,177
  173.   Pbox 215,82,318,177
  174.   Ly%=110
  175.   Restore Beginning_set_up_data1
  176.   For J%=1 To 2
  177.     For I%=1 To 5
  178.       Read Lx%,Ly%
  179.       Put Lx%,Ly%-21,Token$
  180.     Next I%
  181.     Restore Beginning_set_up_data2
  182.   Next J%
  183.   For J%=1 To 2
  184.     For I%=1 To 5
  185.       Position_token%(J%,I%)=1
  186.     Next I%
  187.   Next J%
  188.   For J%=1 To 2
  189.     For I%=6 To 9
  190.       Position_token%(J%,I%)=0
  191.     Next I%
  192.   Next J%
  193.   Deftext 5,0,0,6
  194.   Text 20+Offset%(1),193,Player_name$(1)
  195.   Deftext 1,0,0,6
  196.   Text 233+Offset%(2),193,Player_name$(2)
  197.   Player%=Random(2)+1
  198. Return
  199. '
  200. Procedure New_player
  201.   If Player%=1
  202.     Player%=2
  203.   Else
  204.     Player%=1
  205.   Endif
  206. Return
  207. '
  208. Procedure Start_round
  209.   For I%=1 To 2
  210.     P%=I%
  211.     If Token%(P%)<1
  212.       O_t$="any tokens!"
  213.       @Out_of_tokens
  214.     Endif
  215.     Exit If Game_over%=1
  216.   Next I%
  217.   If Game_over%=1
  218.     Goto Good_luck
  219.   Endif
  220.   Showm
  221.   For I%=1 To 2
  222.     Deftext Clor%(I%),0,0,13
  223.     P%=I%
  224.     T$=Player_name$(I%)+", put a token in the pot."
  225.     Text 27+Offset%(I%),72,T$
  226.     Pb%=I%
  227.     P%=I%
  228.     @Player_box
  229.     @Put_token_in_the_pot
  230.     @Clear_player_box
  231.     @Clear_instructions
  232.   Next I%
  233.   Good_luck:
  234. Return
  235. '
  236. Procedure Round_over
  237.   Hidem
  238.   Deftext 12,0,0,13
  239.   Text 51,72,"The pot needs more tokens!"
  240.   Pause 25
  241.   @Alert_sound
  242.   Pause 50
  243.   @Clear_instructions
  244. Return
  245. '
  246. ' ********************************* POT ********************************
  247. Procedure Put_token_in_the_pot
  248.   Got_one%=0
  249.   Color Clor%(P%)
  250.   If P%=1
  251.     Box 0,81,105,178
  252.   Else
  253.     Box 214,81,319,178
  254.   Endif
  255.   Showm
  256.   Do
  257.     Start:
  258.     @Let_go
  259.     Repeat
  260.       Mouse Mx%,My%,Mk%
  261.     Until Mk%>0
  262.     If Mx%>0 And Mx%<44 And My%>0 And My%<18 And Mk%>0
  263.       @Wanna_quit
  264.       Goto Start
  265.     Endif
  266.     If Mx%>275 And Mx%<319 And My%>0 And My%<18
  267.       @Info
  268.       Goto Start
  269.     Endif
  270.     If P%=1
  271.       Restore Player1_token_position_data
  272.     Else
  273.       Restore Player2_token_position_data
  274.     Endif
  275.     For K%=1 To 9
  276.       Read Lx%,Ly%,Rx%,Ry%,P_t%
  277.       If Mx%>Lx% And Mx%<Rx% And My%>Ly%-21 And My%<Ry%-21 And Position_token%(P%,P_t%)=1
  278.         Deffill 0
  279.         Pbox Lx%+1,Ly%+1-21,Rx%-1,Ry%-1-21
  280.         Position_token%(P%,P_t%)=0
  281.         Dec Token%(P%)
  282.         Got_one%=1
  283.       Endif
  284.       Exit If Got_one%=1
  285.     Next K%
  286.     If Got_one%=0
  287.       @Buzz_sound
  288.     Endif
  289.     Exit If Got_one%=1
  290.   Loop
  291.   Hidem
  292.   @Clear_token_box
  293.   Inc Pot_token%
  294.   @Add_pot_token
  295. Return
  296. '
  297. Procedure Take_token_from_the_pot
  298.   Got_one%=0
  299.   Color Clor%(Player%)
  300.   Box 0,21,319,53
  301.   Showm
  302.   Do
  303.     Start2:
  304.     @Let_go
  305.     Repeat
  306.       Mouse Mx%,My%,Mk%
  307.     Until Mk%>0
  308.     If Mx%>0 And Mx%<44 And My%>0 And My%<18 And Mk%>0
  309.       @Wanna_quit
  310.       Goto Start2
  311.     Endif
  312.     If Mx%>275 And Mx%<319 And My%>0 And My%<18
  313.       @Info
  314.       Goto Start2
  315.     Endif
  316.     Restore Pot_token_position_data
  317.     For J%=1 To 10
  318.       Read Lx%
  319.       If Mx%>Lx% And Mx%<Lx%+31 And My%>21 And My%<53 And Position_pot_token%(J%)=1
  320.         Dec Pot_token%
  321.         Position_pot_token%(J%)=0
  322.         Deffill 0
  323.         Pbox Lx%,22,Lx%+31,52
  324.         Got_one%=1
  325.       Endif
  326.     Next J%
  327.     If Got_one%=0
  328.       @Buzz_sound
  329.     Endif
  330.     Exit If Got_one%=1
  331.   Loop
  332.   Hidem
  333.   Got_one%=0
  334.   If Player%=1
  335.     Restore Beginning_set_up_data1
  336.   Else
  337.     Restore Beginning_set_up_data2
  338.   Endif
  339.   For K%=1 To 9
  340.     Read Lx%,Ly%
  341.     If Position_token%(Player%,K%)=0
  342.       Position_token%(Player%,K%)=1
  343.       Put Lx%,Ly%-21,Token$
  344.       @Other_sound
  345.       Inc Token%(Player%)
  346.       Got_one%=1
  347.     Endif
  348.     Exit If Got_one%=1
  349.   Next K%
  350.   @Clear_pot_box
  351. Return
  352. '
  353. Procedure Add_pot_token
  354.   Got_one%=0
  355.   Restore Pot_token_position_data
  356.   For L%=1 To Pot_token%
  357.     Read Lx%
  358.     If Position_pot_token%(L%)=0
  359.       Put Lx%+1,24,Token$
  360.       @Other_sound
  361.       Position_pot_token%(L%)=1
  362.       Got_one%=1
  363.     Endif
  364.     Exit If Got_one%=1
  365.   Next L%
  366. Return
  367. '
  368. Procedure Gimmel                         ! take all of the pot
  369.   Token_share%=Pot_token%
  370.   If Token%(Player%)+Token_share%=10
  371.     Pause 75
  372.     @Clear_instructions
  373.     T$=Player_name$(Player%)+" has all the tokens!"
  374.     For Q%=1 To 4
  375.       Deftext Q%+1,0,0,13
  376.       If Q%=4
  377.         Deftext 12,0,0,13
  378.       Endif
  379.       Text 48+Offset%(Player%),72,T$
  380.       Sound 1,15,1,4,4
  381.       Sound 1,15,8,4,10
  382.       Sound 1,0,0,0,0
  383.       Pause 10
  384.     Next Q%
  385.     Pause 30
  386.     Winner%=Player%
  387.     @Win
  388.   Endif
  389.   If Game_over%=1
  390.     Goto Won_it
  391.   Endif
  392.   For I%=1 To Token_share%
  393.     @Take_token_from_the_pot
  394.   Next I%
  395.   Won_it:
  396. Return
  397. '
  398. Procedure Heh                            ! take half of the pot
  399.   If Pot_token%=3 Or Pot_token%=5 Or Pot_token%=7 Or Pot_token%=9
  400.     P_t%=Pot_token%+1
  401.   Else
  402.     P_t%=Pot_token%
  403.   Endif
  404.   Token_share%=P_t%/2
  405.   For I%=1 To Token_share%
  406.     @Take_token_from_the_pot
  407.   Next I%
  408. Return
  409. '
  410. Procedure Shin                           ! put 1 token in the pot
  411.   P%=Player%
  412.   If Token%(Player%)<2
  413.     O_t$="two tokens!"
  414.     @Out_of_tokens
  415.   Endif
  416.   If Game_over%=1
  417.     @Clear_instructions
  418.     Goto Maybe_next_time
  419.   Endif
  420.   For Q%=1 To 2
  421.     @Put_token_in_the_pot
  422.   Next Q%
  423.   Maybe_next_time:
  424. Return
  425. '
  426. Procedure Out_of_tokens
  427.   Pause 100
  428.   @Clear_instructions
  429.   Deftext 12,0,0,13
  430.   T$=Player_name$(P%)+" doesn't have "+O_t$
  431.   Text 27+Offset%(P%),72,T$
  432.   @Dud_sound
  433.   Pause 100
  434.   If P%=1
  435.     Winner%=2
  436.   Else
  437.     Winner%=1
  438.   Endif
  439.   @Win
  440. Return
  441. '
  442. Procedure Win
  443.   @Clear_instructions
  444.   Deftext 12,0,0,13
  445.   T$=Player_name$(Winner%)+" has won the game!"
  446.   Text 57+Offset%(Winner%),72,T$
  447.   First_time%=0
  448.   Pause 20
  449.   @Dreidel_music
  450.   @Clear_instructions
  451.   Game_over%=1
  452. Return
  453. '
  454. ' **************************** INSTRUCTIONS ****************************
  455. Procedure Clear_instructions
  456.   Deffill 0
  457.   Pbox 1,57,318,77
  458.   Pause 10
  459. Return
  460. '
  461. Procedure Player_box
  462.   Deffill Clor%(Pb%)
  463.   If Pb%=1
  464.     Fill 2,198
  465.   Else
  466.     Fill 216,198
  467.   Endif
  468. Return
  469. '
  470. Procedure Clear_player_box
  471.   Deffill 0
  472.   Fill 2,198
  473.   Fill 216,198
  474. Return
  475. '
  476. Procedure Clear_token_box
  477.   Color 8
  478.   Box 0,81,105,178
  479.   Box 214,81,319,178
  480. Return
  481. '
  482. Procedure Clear_dreidel_box
  483.   Color 8
  484.   Box 108,81,211,199
  485. Return
  486. '
  487. Procedure Clear_pot_box
  488.   Color 8
  489.   Box 0,21,319,53
  490. Return
  491. '
  492. ' ****************************** DIALOGS *******************************
  493. Procedure Info
  494.   Hidem
  495.   Sget Screen$
  496.   Deffill 10
  497.   Fill 276,1
  498.   @Select_sound
  499.   @Alert_box
  500.   @Let_go
  501.   Deftext 5,0,0,6
  502.   Text 8,70,"  The dreidel is a spinning top with"
  503.   Text 5,80,"  four sides.  Each side has a Hebrew"
  504.   Text 7,90,"  letter on it.  Players take tokens"
  505.   Text 16,100,"  from the pot--or put tokens in--"
  506.   Text 10,110,"  depending on the letter facing up"
  507.   Text 7,120,"  when the top stops spinning.  When"
  508.   Text 7,130,"  the pot has fewer than two tokens,"
  509.   Text 11,140,"    each player puts a token in."
  510.   Deftext 13,0,0,6
  511.   Text 10,152," D.A. Brumleve's Compukid Connection"
  512.   Text 14,162,"column in Analog Computing can bring"
  513.   Text 14,172,"kidprgs to your mailbox every month."
  514.   Text 11,182,"  Call (818) 760-8983 to subscribe!"
  515.   Deftext 5,1,0,4
  516.   Text 10,192,"     <<  PRESS MOUSE BUTTON TO CONTINUE.  >>"
  517.   @Let_go
  518.   Repeat
  519.   Until Mousek
  520.   Sput Screen$
  521.   @Let_go
  522.   Showm
  523. Return
  524. '
  525. Procedure Wanna_quit
  526.   Deffill 2
  527.   Fill 2,2
  528.   @Select_sound
  529.   @Save_routine
  530.   Deffill 0
  531.   Fill 2,2
  532.   @Let_go
  533. Return
  534. '
  535. Procedure Alert_box
  536.   Deffill 1
  537.   Pbox 0,56,319,199
  538.   Color 5
  539.   Box 0,56,319,199
  540.   Box 1,57,318,198
  541.   Box 3,59,316,196
  542. Return
  543. '
  544. Procedure Save_routine
  545.   Sget Screen$
  546.   @Alert_box
  547.   @Save_alert
  548.   Deftext 0,0,0,6
  549.   Text 52,100,"Do you really want to quit?"
  550.   @Let_go
  551.   Repeat
  552.     Mouse Mmx%,Mmy%,Mmk%
  553.   Until Mmk%>0 And Mmy%>118 And Mmy%<172 And ((Mmx%>48 And Mmx%<122) Or (Mmx%>197 And Mmx%<271))
  554.   @Select_sound
  555.   Deffill 5
  556.   If Mmx%>48 And Mmx%<122
  557.     Hidem
  558.     Fill 49,119
  559.     Pause 15
  560.     @Finale_sound
  561.     Cls
  562.     @Restore_palette
  563.     Showm
  564.     End
  565.   Else
  566.     Fill 198,119
  567.     Pause 15
  568.     Sput Screen$
  569.   Endif
  570. Return
  571. '
  572. Procedure Save_alert
  573.   Color 5
  574.   Box 48,118,122,172
  575.   Box 197,118,271,172
  576.   Box 201,122,267,168
  577.   Deffill 5
  578.   Pbox 52,122,118,168
  579.   Deftext 0,0,0,13
  580.   Text 70,150,"Yes!"
  581.   Text 225,150,"No."
  582. Return
  583. '
  584. ' ************************* INPUT PLAYERS' NAMES ***********************
  585. Procedure Player_name
  586.   For Q%=1 To 2
  587.     @Alert_box
  588.     P_n$="Player "+Str$(Q%)+", type your name"
  589.     Deftext 0,0,0,6
  590.     Text 65,100,P_n$
  591.     Text 85,110,"and press <Return>."
  592.     @Get_name
  593.     Player_name$(Q%)=Nw_word$
  594.   Next Q%
  595.   For I%=1 To 2
  596.     If Player_name$(I%)=""
  597.       Player_name$(I%)="PLAYER "+Str$(I%)
  598.     Endif
  599.   Next I%
  600.   For J%=1 To 2
  601.     Got_one%=0
  602.     For I%=1 To 8
  603.       If Len(Player_name$(J%))=I%
  604.         Offset%(J%)=((8-I%)*8)/2
  605.         Got_one%=1
  606.       Endif
  607.       Exit If Got_one%=1
  608.     Next I%
  609.   Next J%
  610.   Sput Screen$
  611.   Showm
  612. Return
  613. '
  614. Procedure Get_name
  615.   Deftext 0,0,0,13
  616.   Gx%=111
  617.   For I%=1 To 8
  618.     Text Gx%,154,"_ "
  619.     Add Gx%,11
  620.   Next I%
  621.   Get 5,50,161,193,Temp_screen$
  622.   A%=0
  623.   Hidem
  624.   For I%=1 To 8
  625.     Lttr$(I%)=""
  626.   Next I%
  627.   Ltter_count%=1
  628.   Nw_word$=""
  629.   Gx%=110
  630.   Df%=1
  631.   Repeat
  632.     Backed_up:
  633.     Repeat
  634.     Until Inkey$=""
  635.     A%=Inp(2)
  636.     ' If the user presses the Backspace key, the last letter typed is erased.
  637.     If A%=8
  638.       Put 5,50,Temp_screen$
  639.       Lttr$(Ltter_count%-1)=""
  640.       Deffill Df%,2,8
  641.       Pbox 100,125,200,152
  642.       If Ltter_count%>1
  643.         Dec Ltter_count%
  644.         Sub Gx%,11
  645.         Lx%=110
  646.         For I%=1 To Ltter_count%
  647.           Deftext 0,0,0,13
  648.           Text Lx%,150,Lttr$(I%)
  649.           Add Lx%,11
  650.         Next I%
  651.       Endif
  652.       Goto Backed_up
  653.     Endif
  654.     ' The following clause renumbers the ASCII code of the letter typed
  655.     ' if the user is typing in lower case.
  656.     If A%>90
  657.       A%=A%-32
  658.     Endif
  659.     If A%>63 And A%<91 And Ltter_count%<9
  660.       Lttr$(Ltter_count%)=Chr$(A%)
  661.       Deftext 0,0,0,13
  662.       Text Gx%,150,Lttr$(Ltter_count%)
  663.       Inc Ltter_count%
  664.       Add Gx%,11
  665.     Endif
  666.     Pause 5
  667.   Until A%=13
  668.   Dec Ltter_count%
  669.   For I%=1 To Ltter_count%
  670.     Nw_word$=Nw_word$+Lttr$(I%)
  671.   Next I%
  672. Return
  673. '
  674. ' *************************** DISK ACTIVITIES **************************
  675. Procedure Load_spinner
  676.   Zz%=1
  677.   If Not Exist(Filename$)
  678.     @Restore_palette
  679.     T$=" |You must have "+Filename$+"|in the same directory and"+"|drive to run this program!"
  680.     Alert 3,T$,1,"Oops!",Dummy%
  681.     End
  682.   Endif
  683.   Open "I",#1,Filename$
  684.   For X%=1 To Num%
  685.     Hidem
  686.     Input #1,Clip_len%(X%),Colr_len%(X%),Clip_width%(X%),Clip_hite%(X%),Rez_pic%(X%)
  687.     Lttlepic$(X%)=String$(Clip_len%(X%),0)
  688.     Colr$(X%)=String$(Colr_len%(X%),0)
  689.     Bget #1,Varptr(Colr$(X%)),Colr_len%(X%)
  690.     Bget #1,Varptr(Lttlepic$(X%)),Clip_len%(X%)
  691.     Add Zz%,1
  692.   Next X%
  693.   Close #1
  694. Return
  695. '
  696. ' ******************************* SCREENS ******************************
  697. Procedure Title
  698.   Cls
  699.   Deftext 5,1,0,13
  700.   Text 145,50,"D R E I D E L"
  701.   Deftext 1,0,0,6
  702.   Text 109,75,"  A Traditional Game"
  703.   Text 111,90,"      of Chance"
  704.   Ss%=110
  705.   Deftext 12,1,0,4
  706.   Text 45,35+Ss%,"YET ANOTHER KIDPRG  IN GFA BASIC FROM"
  707.   Deftext 12,0,0,4
  708.   Text 155,35+Ss%,Chr$(191)
  709.   Deftext 2,0,0,6
  710.   Text 35,45+Ss%,"         D.A. Brumleve"
  711.   Deftext 15,5,0,4
  712.   Text 52,54+Ss%,"                  ANALOG COMPUTING"
  713.   Deftext 15,1,0,4
  714.   Text 52,54+Ss%,"COPYRIGHT 1989 BY"
  715.   Deftext 2,1,0,4
  716.   Text 60,63+Ss%,"          VERSION 1.2"
  717.   Ss%=80
  718.   Deftext 5,0,0,6
  719.   Text 35,115+Ss%,"As published originally in    !"
  720.   Sty%=46+Ss%
  721.   Stx%=48
  722.   Color 1
  723.   Box 204+Stx%,52+Sty%,224+Stx%,73+Sty%
  724.   Color 5
  725.   Box 205+Stx%,53+Sty%,223+Stx%,72+Sty%
  726.   Deffill 5,2,8
  727.   Pbox 205+Stx%,66+Sty%,223+Stx%,72+Sty%
  728.   Deffill 1,2,8
  729.   Pbox 206+Stx%,54+Sty%,222+Stx%,65+Sty%
  730.   Deftext 5,1,0,13
  731.   Text 207+Stx%,65+Sty%," T"
  732.   Text 205+Stx%,65+Sty%,"S"
  733.   Deftext 1,1,0,4
  734.   Text 205+Stx%,71+Sty%,"LOG"
  735.   Put 20,0,Spinner$(1)
  736.   Void Xbios(6,L:Varptr(Colr$(4)))
  737.   Pause 20
  738.   Sound 1,0,1,4,0
  739.   Wave 1,1,8,1000,0
  740.   For I%=1 To 6
  741.     For J%=1 To 3
  742.       Put 20,0,Spinner$(J%)
  743.       Pause 2
  744.     Next J%
  745.   Next I%
  746.   Put 20,0,Spinner$(4)
  747.   Pause 7
  748.   Wave 0,0
  749.   Put 46,12,Dreidel$(1)
  750.   Pause 30
  751.   Deftext 12,0,0,6
  752.   First_time%=1
  753.   @Dreidel_music
  754.   Pause 70
  755. Return
  756. '
  757. Procedure Main_screen
  758.   Restore Screen_box_data
  759.   For I%=1 To 12
  760.     Read Lx%,Ly%,Rx%,Ry%,C%
  761.     Color C%
  762.     Box Lx%,Ly%,Rx%,Ry%
  763.   Next I%
  764.   Deftext 5,0,0,6
  765.   Text 133,6,"DREIDEL"
  766.   Deftext 1,0,0,4
  767.   Text 98,14,"FROM ANALOG COMPUTING"
  768.   Deffill 2
  769.   Fill 4,4
  770.   Deftext 0,0,0,6
  771.   Text 7,12,"EXIT"
  772.   Deffill 10
  773.   Fill 315,5
  774.   Deftext 0,0,0,6
  775.   Text 281,12,"INFO"
  776.   Sget Screen$
  777. Return
  778. '
  779. ' **************************** WATCH THE MOUSE *************************
  780. Procedure Let_go
  781.   Repeat
  782.     Mouse Ax%,Ay%,Ak%
  783.   Until Ak%=0
  784. Return
  785. '
  786. ' ***************************** COLOR PALETTE **************************
  787. Procedure Check_rez
  788.   Rez%=Xbios(4)
  789.   If Rez%<>0
  790.     Alrt$=" |    D R E I D E L |requires Low Resolution."
  791.     Alert 3,Alrt$,1,"Oops!",Dummy%
  792.     End
  793.   Endif
  794. Return
  795. '
  796. Procedure Save_palette
  797.   For I%=0 To 15
  798.     Palette%(I%)=Xbios(7,W:I%,W:-1)
  799.   Next I%
  800. Return
  801. '
  802. Procedure Restore_palette
  803.   For I%=0 To 15
  804.     Setcolor I%,Palette%(I%)
  805.   Next I%
  806. Return
  807. '
  808. Procedure Black_screen
  809.   For I%=0 To 15
  810.     Setcolor I%,0,0,0
  811.   Next I%
  812. Return
  813. '
  814. ' ******************************* SOUNDS *******************************
  815. Procedure Dreidel_music
  816.   Restore Dreidel_name_data
  817.   For I%=1 To 32
  818.     If I%=1 Or I%=9 Or I%=17 Or I%=26
  819.       Read D$,Lx%,Nn%
  820.       If First_time%=1
  821.         Deffill 0
  822.         Pbox 30,110,95,125
  823.         Put 46,12,Dreidel$(Nn%)
  824.         Text Lx%,120,D$
  825.       Else
  826.         If Nn%=4
  827.           Nn%=11
  828.         Endif
  829.         Deftext Nn%+1,0,0,13
  830.         Text 57+Offset%(Winner%),72,T$
  831.       Endif
  832.     Else
  833.       Read Nt%,Dur%
  834.       If Nt%=0
  835.         Pause Dur%*3
  836.         Goto Skipit
  837.       Endif
  838.       Sound 1,15,Nt%,4,Dur%*3
  839.       Sound 1,0,0,0,1
  840.       Skipit:
  841.     Endif
  842.   Next I%
  843. Return
  844. '
  845. Procedure Select_sound
  846.   Sound 1,15,6,3,2
  847.   Sound 1,15,6,4,2
  848.   Sound 1,15,8,4,6
  849.   Sound 1,0,0,0,0
  850. Return
  851. '
  852. Procedure Buzz_sound
  853.   Sound 1,15,1,3,5
  854.   Sound 1,0,0,0,0
  855. Return
  856. '
  857. Procedure Other_sound
  858.   Sound 1,15,6,5,2
  859.   Sound 1,0,0,0,0
  860. Return
  861. '
  862. Procedure Finale_sound
  863.   Pause 10
  864.   Restore Finale_data
  865.   For I%=1 To 6
  866.     Read Nt%,Dur%
  867.     Sound 1,15,Nt%,4,Dur%*3
  868.     Sound 1,0,0,0,1
  869.   Next I%
  870. Return
  871. '
  872. Procedure Dud_sound
  873.   For Oct%=4 Downto 1
  874.     For Nt%=12 Downto 1
  875.       Sound 1,15,Nt%,Oct%,2
  876.     Next Nt%
  877.   Next Oct%
  878.   Sound 1,0,0,0,0
  879. Return
  880. '
  881. Procedure Alert_sound
  882.   Sound 1,15,10,3,10
  883.   Sound 1,15,3,3,5
  884.   Sound 1,0,0,0,0
  885. Return
  886. '
  887. ' ******************************** DATA ********************************
  888. Screen_box_data:
  889. Data 0,0,44,18,9
  890. Data 3,3,41,15,9
  891. Data 275,0,319,18,9
  892. Data 278,3,316,15,9
  893. Data 0,21,319,53,8
  894. Data 0,181,105,199,9
  895. Data 3,184,102,196,9
  896. Data 0,81,105,178,8
  897. Data 108,81,211,199,8
  898. Data 214,181,319,199,9
  899. Data 217,184,316,196,9
  900. Data 214,81,319,178,8
  901. '
  902. Dreidel_data:
  903. Data Nun: you don't lose or gain any tokens.,5
  904. Data Gimmel: take all the tokens in the pot!,5
  905. Data Heh: take half the tokens in the pot!,12
  906. Data Shin: put two tokens in the pot.,35
  907. Beginning_set_up_data1:
  908. Data 9,108,39,108,69,108,9,138,39,138,69,138,9,168,39,168,69,168
  909. Beginning_set_up_data2:
  910. Data 223,108,253,108,283,108,223,138,253,138,283,138,223,168,253,168,283,168
  911. '
  912. Pot_token_position_data:
  913. Data 5,35,66,97,128,159,190,221,252,283,319
  914. '
  915. Player1_token_position_data:
  916. Data 0,102,37,136,1
  917. Data 37,102,67,136,2
  918. Data 67,102,105,136,3
  919. Data 0,136,37,166,4
  920. Data 37,136,67,166,5
  921. Data 67,136,105,166,6
  922. Data 0,166,37,199,7
  923. Data 37,166,67,199,8
  924. Data 67,166,105,199,9
  925. '
  926. Player2_token_position_data:
  927. Data 214,102,251,136,1
  928. Data 251,102,281,136,2
  929. Data 281,102,319,136,3
  930. Data 214,136,251,166,4
  931. Data 251,136,281,166,5
  932. Data 281,136,319,166,6
  933. Data 214,166,251,199,7
  934. Data 251,166,281,199,8
  935. Data 281,166,319,199,9
  936. '
  937. Dreidel_name_data:
  938. Data nun,58,1
  939. Data 8,4
  940. Data 5,4
  941. Data 8,4
  942. Data 5,4
  943. Data 8,4
  944. Data 5,4
  945. Data 0,4
  946. Data gimmel,47,2
  947. Data 6,4
  948. Data 8,4
  949. Data 8,4
  950. Data 6,4
  951. Data 5,4
  952. Data 6,8
  953. Data 0,4
  954. Data heh,59,3
  955. Data 10,4
  956. Data 6,4
  957. Data 3,4
  958. Data 6,4
  959. Data 3,4
  960. Data 6,4
  961. Data 3,4
  962. Data 0,4
  963. Data shin,54,4
  964. Data 8,4
  965. Data 8,4
  966. Data 6,4
  967. Data 5,4
  968. Data 3,4
  969. Data 1,8
  970. '
  971. Finale_data:
  972. Data 8,4
  973. Data 8,4
  974. Data 6,4
  975. Data 5,4
  976. Data 3,4
  977. Data 1,8
  978. '
  979.